News All Tests
Current file: /home/estudydev/workspace/MSP09/web/news/tests/class.newscategorywaitinglist.inc.php
Legend: executed not executed dead code

  Coverage
  Classes Methods Lines
Total
100.00 %100.00%
100.00% 1 / 1
0.00 %0.00%
0.00% 0 / 7
2.70 %2.70%
2.70% 2 / 74
 
NewsCategoryWaitinglist
100.00 %100.00%
100.00% 1 / 1
0.00 %0.00%
0.00% 0 / 7
1.37 %1.37%
1.37% 1 / 73
 public function __construct($catID, $courses, $categorySettings = NULL)
0.00 %0.00%
0.00% 0 / 1
0.00 %0.00%
0.00% 0 / 3
 public function echoNews($courseID, $usergroup = NULL)
0.00 %0.00%
0.00% 0 / 1
0.00 %0.00%
0.00% 0 / 3
 public function isInstalled($courseID)
0.00 %0.00%
0.00% 0 / 1
0.00 %0.00%
0.00% 0 / 1
 public function canSelectPeriod()
0.00 %0.00%
0.00% 0 / 1
0.00 %0.00%
0.00% 0 / 1
 public function getNewsHeaderTitle($courseID = NULL, $type = NULL)
0.00 %0.00%
0.00% 0 / 1
0.00 %0.00%
0.00% 0 / 5
 protected function getNewsByPeriod($courseID, $from, $to, $lastvisit, $usergroup = NULL)
0.00 %0.00%
0.00% 0 / 1
0.00 %0.00%
0.00% 0 / 27
 protected function echoNewsEntry($entry, $courseID, $usergroup = NULL)
0.00 %0.00%
0.00% 0 / 1
0.00 %0.00%
0.00% 0 / 32


       1                 : <?php                                                                                                     
       2                 : /*--------------------------------------------------------------------------+                             
       3                 : This file is part of eStudy.                                                                              
       4                 : news/classes/class.NewsCategoryWaitinglist.inc.php                                                        
       5                 : - Modulgruppe:  News                                                                                      
       6                 : - Beschreibung: Klasse für die News-Kategorie Warteliste.                                                
       7                 : - Version:      1.1.2.4, 24/01/08                                                                         
       8                 : - Autor(en):    Corinna Kropf <corinna.kropf@mni.fh-giessen.de>                                           
       9                 : +---------------------------------------------------------------------------+                             
      10                 : This program is free software; you can redistribute it and/or                                             
      11                 : modify it under the terms of the GNU General Public License                                               
      12                 : as published by the Free Software Foundation; either version 2                                            
      13                 : of the License, or any later version.                                                                     
      14                 : +---------------------------------------------------------------------------+                             
      15                 : This program is distributed in the hope that it will be useful,                                           
      16                 : but WITHOUT ANY WARRANTY; without even the implied warranty of                                            
      17                 : MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the                                             
      18                 : GNU General Public License for more details.                                                              
      19                 : You should have received a copy of the GNU General Public License                                         
      20                 : along with this program; if not, write to the Free Software                                               
      21                 : Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.                               
      22                 : +--------------------------------------------------------------------------*/                             
      23                 :                                                                                                           
      24               1 : require_once ("class.newscategory.inc.php");                                                              
      25                 :                                                                                                           
      26                 : /**                                                                                                       
      27                 :  * Klasse für die News-Kategorie Warteliste.                                                             
      28                 :  * @package eStudy.News                                                                                   
      29                 :  * @version 1.1.2.4, 24/01/08                                                                             
      30                 :  * @author  Corinna Kropf <corinna.kropf@mni.fh-giessen.de>                                               
      31                 :  */                                                                                                       
      32               1 : class NewsCategoryWaitinglist extends NewsCategory                                                        
      33                 : {                                                                                                         
      34                 :    /**                                                                                                    
      35                 :      * Flag fuer die Anzeige der News-Eintraege                                                           
      36                 :      * @var bool                                                                                          
      37                 :      */                                                                                                   
      38                 :     private $dark;                                                                                        
      39                 :    /**                                                                                                    
      40                 :      * HTML-Template                                                                                      
      41                 :      * @var Template                                                                                      
      42                 :      */                                                                                                   
      43                 :     private $newsTemplateFoyer;                                                                           
      44                 :     /**                                                                                                   
      45                 :      * Konstruktor                                                                                        
      46                 :      */                                                                                                   
      47                 :     public function __construct($catID, $courses, $categorySettings = null)                               
      48                 :     {                                                                                                     
      49               0 :         parent::__construct($catID, $courses, $categorySettings);                                         
      50               0 :         $this->newsTemplateFoyer = new Template(PATH_TO_ROOT."news/templates/newswaitinglist_forum.html");
      51               0 :     }                                                                                                     
      52                 :    /**                                                                                                    
      53                 :      * Überschreibt die Methode der Oberklasse,                                                          
      54                 :      * um weitere Initialisierungen vor der Ausgabe zu machen.                                            
      55                 :      * @see NewsCategory                                                                                  
      56                 :      */                                                                                                   
      57                 :     public function echoNews($courseID, $usergroup = null)                                                
      58                 :     {                                                                                                     
      59               0 :         $this->dark = false;                                                                              
      60               0 :         parent::echoNews($courseID, $usergroup);                                                          
      61               0 :     }                                                                                                     
      62                 :     /**                                                                                                   
      63                 :      * @see NewsCategory                                                                                  
      64                 :      */                                                                                                   
      65                 :     public function isInstalled($courseID)                                                                
      66                 :     {                                                                                                     
      67               0 :         return true;                                                                                      
      68                 :     }                                                                                                     
      69                 :     /**                                                                                                   
      70                 :      * @see NewsCategory                                                                                  
      71                 :      */                                                                                                   
      72                 :     public function canSelectPeriod() {                                                                   
      73               0 :         return false;                                                                                     
      74                 :     }                                                                                                     
      75                 :     /**                                                                                                   
      76                 :      * @see NewsCategory                                                                                  
      77                 :      * @todo Refacs und verbessertes I18N                                                                 
      78                 :      */                                                                                                   
      79                 :     public function getNewsHeaderTitle($courseID = null, $type = null) {                                  
      80               0 :         $newsCount = $this->news["count"];                                                                
      81               0 :         if ($newsCount > 1) $title = sprintf( $this->translate->_("%1\$s Registrierungen"), $newsCount);  
      82               0 :         else $title = $this->translate->_("1 Registrierung");                                             
      83               0 :         $title.= $this->translate->_(" auf der Warteliste");                                              
      84                 :                                                                                                           
      85               0 :         return $title;                                                                                    
      86                 :     }                                                                                                     
      87                 :     /**                                                                                                   
      88                 :      * @see NewsCategory                                                                                  
      89                 :      */                                                                                                   
      90                 :     protected function getNewsByPeriod($courseID, $from, $to, $lastvisit, $usergroup = null)  {           
      91               0 :         if (isset($courseID) && isset($lastvisit) && isset($usergroup))                                   
      92               0 :         {                                                                                                 
      93               0 :             if(!is_numeric($courseID) || !is_numeric($lastvisit) || !is_numeric($usergroup)) return null; 
      94                 :                                                                                                           
      95               0 :             global $db;                                                                                   
      96               0 :             $this->news = array();                                                                        
      97                 :                                                                                                           
      98                 :             // Nur im Foyer                                                                               
      99                 :                // Neu registrierte, aber noch inaktive Mitglieder                                         
     100               0 :             if ($courseID == 0 && $usergroup == ADMIN) {                                                  
     101                 :                    $sql =   "SELECT * FROM waitinglist "                                                  
     102               0 :                              ."WHERE CreationTime>='".Data::toMysql($lastvisit)."' "                      
     103               0 :                            ."ORDER BY CreationTime";                                                      
     104               0 :                 $this->news["data"] = $db->get_results($sql, ARRAY_A);                                    
     105               0 :                 if( $db->num_rows > 0) $this->news["count"] = $db->num_rows;                              
     106               0 :             }                                                                                             
     107                 :             // Neue Einträge in Kurs-Warteliste                                                          
     108               0 :             if ($courseID > 0 && ($usergroup == ADMIN || $usergroup == DOZENT)) {                         
     109                 :                 $sql =   "SELECT * FROM user_course_wait "                                                
     110               0 :                         ."WHERE courseID='".Data::toMysql($courseID)."' "                                 
     111               0 :                         ."AND regTime>='".date("Y-m-d H:i:s", $lastvisit) ."' "                           
     112               0 :                         ."ORDER BY regTime";                                                              
     113               0 :                    $this->news["data"] = $db->get_results($sql, ARRAY_A);                                 
     114               0 :                 if ($db->num_rows > 0)                                                                    
     115               0 :                 {                                                                                         
     116               0 :                     $this->news["count"] = $db->num_rows;                                                 
     117               0 :                        foreach($this->news["data"] as $newUser) {                                         
     118               0 :                         $this->users[$newUser["userID"]] = $newUser["userID"];                            
     119               0 :                        }                                                                                  
     120               0 :                 }                                                                                         
     121               0 :             }                                                                                             
     122                 :                                                                                                           
     123               0 :             if(!isset($this->news["count"])) $this->news = null;                                          
     124               0 :         }                                                                                                 
     125                 :                                                                                                           
     126               0 :         return $this->news;                                                                               
     127                 :     }                                                                                                     
     128                 :     /**                                                                                                   
     129                 :      * @see NewsCategory                                                                                  
     130                 :      */                                                                                                   
     131                 :     protected function echoNewsEntry($entry, $courseID, $usergroup = null)                                
     132                 :     {                                                                                                     
     133               0 :         if(!isset($this->dark) || !isset($entry) || !isset($courseID)) return;                            
     134                 :                                                                                                           
     135               0 :         $cellStyle = ($this->dark ? "Dark" : "");                                                         
     136               0 :         $this->dark = !$this->dark;                                                                       
     137                 :                                                                                                           
     138               0 :         $waitinglistScript = PATH_TO_ROOT."admin/waitinglist.php";                                        
     139               0 :         if ($courseID == 0) {                                                                             
     140               0 :             $data = @unserialize($entry["Data"]);                                                         
     141               0 :             if (isset($data["Vorname"]) && isset($data["Nachname"])) {                                    
     142               0 :                 $name = $data["Vorname"]." ".$data["Nachname"];                                           
     143               0 :             } else $name = "";                                                                            
     144               0 :             $reason = (isset($data["Grund"]))? $data["Grund"] : "";                                       
     145               0 :             $mail = Data::toHTML($entry["Email"], false);                                                 
     146               0 :             $creationTime = Output::echoDate("d.m.Y H:i", (int)$entry["CreationTime"]);                   
     147               0 :             $sendlink = "";                                                                               
     148               0 :             if ($entry["mail_sent"] == 0)                                                                 
     149               0 :             {                                                                                             
     150               0 :                   $sendlink = "<a href='$waitinglistScript?action=send&amp;name={$entry['Login']}''>"     
     151               0 :                             . $this->translate->_("Linkmail&nbsp;senden")                                 
     152               0 :                             . "</a><br />";                                                               
     153               0 :             }                                                                                             
     154                 :                                                                                                           
     155               0 :             $g_Entfernen = $this->translate->_("Entfernen");                                              
     156                 :                                                                                                           
     157               0 :             eval($this->newsTemplateFoyer->GetTemplate());                                                
     158               0 :            } else {                                                                                       
     159               0 :                if(isset($this->news["user"]))                                                             
     160               0 :                {                                                                                          
     161                 :                 echo "<tr>"                                                                               
     162               0 :                     ."<td class='tableCell".$cellStyle ."'>"                                              
     163               0 :                     .Output::getUsergroupPicture($entry["userID"], STUDENT)                               
     164               0 :                     ."&nbsp; "                                                                            
     165               0 :                     .$this->getProfileLink($this->news["user"], $entry["userID"], $courseID)              
     166               0 :                     ."</td>"                                                                              
     167               0 :                     ."</tr>\n";                                                                           
     168               0 :                }                                                                                          
     169                 :         }                                                                                                 
     170               0 :     }                                                                                                     
     171                 : }                                                                                                         

Generated by PHPUnit 3.2.21 and Xdebug 2.0.4 at Sat Nov 7 22:04:08 CET 2009.